<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>搜索插入位置</title>
	</head>
	<body>
		<p id="demo"></p>
		<script>
			var arr = [1,3,5,6];
			var target = 5;
			var target = 2;
			var target = 7;
            function show(array,macth){
            	for(var i=0;i<array.length;i++){
            		if(array[i]==macth){
            			document.getElementById('demo').innerHTML=i;
            		}else{
            			array.push(macth);
            			console.log('array',array);
            			var aa=array.sort(function(a,b){
            				return a-b;
            			})
            			console.log('aa',aa);
            			return;
            		}
            	}
            }
            show(arr,target);
		</script>
	</body>
</html>
